package com.liu.jd_demo.controller;

import com.liu.jd_demo.pojo.Content;
import com.liu.jd_demo.service.ContentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author QS.Liu
 * @date 2020/6/29/21:32
 */
@RestController
public class ContentController {

        @Resource
        ContentService contentService;

        @GetMapping("/parse/{keyword}")
        public Boolean parse(@PathVariable("keyword") String keyword){
            Boolean aBoolean = contentService.parseContent(keyword);
            return aBoolean;
        }

        @GetMapping("/searchPage/{keyword}/{page}/{size}")
        public List<Map<String,Object>> search(@PathVariable("keyword") String keyword,@PathVariable("page")Integer page,@PathVariable("size")Integer size){

            List<Map<String, Object>> aa = contentService.searchPage(keyword,page,size);
            return  aa;
        }
    @GetMapping("/searhighchPage/{keyword}/{page}/{size}")
    public List<Map<String,Object>> searchhighPage(@PathVariable("keyword") String keyword,@PathVariable("page")Integer page,@PathVariable("size")Integer size){

        List<Map<String, Object>> aa = contentService.searchhighPage(keyword,page,size);
        return  aa;
    }
}
